<?php

namespace Budget\BudgetBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class IncomeType extends AbstractType
{ 
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('amount', 'money', array('label' => 'Amount:'))
            ->add('comment', null, array('label' => 'Comment:'))   
            ->add('date_created', 'collot_datetime', array(
                'pickerOptions'  => array(
                    'format'         => 'dd.mm.yyyy',
                    'pickerPosition' => 'bottom-left',
                    'minView'        => 'month',
                ),
                'label' => 'Date:'));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'income';
    }
    
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Budget\BudgetBundle\Entity\Income',
        ));
    }

}
